/**
 * 
 */
package com.security.core.authentication;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;

import com.security.core.properties.SecurityConstants;


/**
 * @title AbstractChannelSecurityConfig
 * @version 1.0.0
 * @description 自定义的所有的安全配置的父类
 * @author Dark_blue
 * @date 2019年8月28日
 */
public class AbstractChannelSecurityConfig extends WebSecurityConfigurerAdapter{
	
	@Autowired
	protected AuthenticationSuccessHandler authenticationSuccessHandler;
	
	@Autowired
	protected AuthenticationFailureHandler authenticationFailureHandler;
	
	protected void applyPasswordAuthenticationConfig(HttpSecurity httpSecurity) throws Exception {
		System.out.println("core配置");
		httpSecurity.formLogin()
					.loginPage(SecurityConstants.DEFAULT_UNAUTHENTICATION_URL)
					.loginProcessingUrl(SecurityConstants.DEFAULT_LOGIN_PROCESSING_URL_FORM)
					.successHandler(authenticationSuccessHandler)
					.failureHandler(authenticationFailureHandler);
	}
}
